#include "animal.cpp"
#include "Mamifer.cpp"
#include "Pisica.cpp"
#include "soarece.cpp"
#include <vector>
#define N 20

using namespace std;

int main()
{
	Animal * Animale[N]={NULL};
	Animale[0]=new Soarece();
	Animale[0]->setSex(Gender(2));
	Animale[1]= new Pisica();
	Animale[1]->setSex(Gender(2));
	srand(time(NULL));
	for(int i=0; i<N; i++){
		if(i>=0){
			bool isAnotherFemale = false;
			if( Animale[i]!=NULL && Animale[i]->getSex() != Gender(1)){
				int j=i+1;
				while(Animale[j]!=NULL && j<N)
					++j;
				Animale[j]=Animale[i]->giveBirth();
				Animale[j]->print();
				sleep(1);		
			}
			else{
				int j=2;
				while(j<N && Animale[j]->getSex() != Gender(2))
				++j; 
				i=j-1;
				if (j<N) isAnotherFemale = true;
			}
			if(!isAnotherFemale) i=rand()%2 -1;
		}
	}

		
	
return 0;
}
